﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace Person
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "JsonService" in code, svc and config file together.
    public class JsonService : IJsonService
    {

        public Person[] getPeople()
        {
            List<Person> people = new List<Person>
            {
                new Person{id=1,name="ilker"},
                new Person{id=2,name="yigit"}
            };
            return Collection.people.ToArray();
        }

        public void savePeople(string name)
        {
            Collection.people.Add(new Person { id = Collection.people.Count+1, name = name });
        }

        public class Collection
        {
            public static List<Person> people = new List<Person>
            {
                new Person{id=1,name="ilker"},
                new Person{id=2,name="yigit"}
            };
        }
    }
}
